import { useState, useEffect } from 'react'
import { getMembers } from '~/api/config'

export default function(departmentCode: string) {
  console.log('departmentCode', departmentCode)
  const [configs, setConfigs] = useState<any>([])
  useEffect(() => {
    if (!departmentCode) return
    getMembers(departmentCode).then((res: any) => {
      setConfigs(res)
    })
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [departmentCode])
  return configs
}
